import request from '@/utils/request'

export function obtainPubkey(account) {
  return request({
    method: 'post',
    url: '/service/user/accountEncrypt',
    data: {
      account
    }
  })
}

export function login(acc_key, pass_key) {
  return request({
    url: '/service/user/login',
    method: 'post',
    data: {
      acc_key,
      pass_key
    }
  })
}

export function getInfo(token) {
  return request({
    url: 'service/user/getUserInfo',
    method: 'post'
  })
}

export function logout() {
  return request({
    url: '/service/user/logout',
    method: 'post'
  })
}

export function ResetPwd(account, password, repassword) {
  return request({
    url: '/service/user/ResetPassword',
    method: 'post',
    data: {
      account,
      password,
      repassword
    }
  })
}

export function VerificationCode(account, msg_type, code) {
  return request({
    url: '/service/user/VerificationCode',
    method: 'post',
    data: {
      account,
      msg_type,
      code
    }
  })
}

export function getUserInfo() {
  return request({
    url: '/service/user/getUserInfo',
    method: 'post'
  })
}

export function EditPassword(oldpassword, password, repassword) {
  return request({
    url: '/service/user/EditPassword',
    method: 'post',
    data: {
      oldpassword,
      password,
      repassword
    }
  })
}

export function bindingEmail(email, code) {
  return request({
    url: '/service/user/bindingEmail',
    method: 'post',
    data: {
      email,
      code
    }
  })
}

export function registered(account, password, repassword, countrycode, code) {
  return request({
    url: '/service/user/registered',
    method: 'post',
    data: {
      account,
      password,
      repassword,
      countrycode,
      code
    }
  })
}
